package de.fstyle.android.worldcanvas;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.google.android.gms.maps.SupportMapFragment;

import de.fstyle.android.worldcanvas.fragments.ColorFragment;
import de.fstyle.android.worldcanvas.fragments.MySupportMapFragment;

/**
 * A {@link FragmentPagerAdapter} that returns a fragment corresponding to one
 * of the primary sections of the app.
 */
public class MainPagerAdapter extends FragmentPagerAdapter {

	public MainPagerAdapter(FragmentManager fm) {
		super(fm);
	}

	@Override
	public Fragment getItem(int i) {
		switch (i) {
		case 0:
			Fragment fragment0 = new ColorFragment();
//			Bundle args = new Bundle();
//			args.putInt(ColorFragment.INITIAL_COLOR_ARGUMENT, Color.GREEN);
//			fragment0.setArguments(args);
			return fragment0;
		case 1:
			SupportMapFragment fragment1 = new MySupportMapFragment();
			return fragment1;
		default:
			return new ColorFragment();
		}
	}

	@Override
	public int getCount() {
		return 2;
	}
	
	@Override
	public CharSequence getPageTitle(int position) {
		return "Section " + (position + 1);
	}
	
	@Override
	public float getPageWidth(int position) {
		if (position == 1) {
			return 0.8f;
		} else {
			return super.getPageWidth(position);
		}
	}
}